package apiday01;

/**
 * IndexOfDemo():
 * 检索给定字符串在当前字符串的开始位置；
 */
public class IndexOfDemo {
    public static void main(String[] args) {
        String str="thinking in java";
        int index =str.indexOf("in");
        index=str.indexOf("va");
        System.out.println(index);
        index=str.lastIndexOf("a");
        System.out.println(index);
        index=str.indexOf("cc");
        System.out.println(index);
        index=str.indexOf("va",5);
        System.out.println(index);
        index=str.lastIndexOf("a",0);
        System.out.println(index);
    }
}
